
$('.edit').click(function(event) {
    $('.headstatus').hide();
    $('.formcontent').show();
});

$('input[type="file"]').change(function (event) {
    var _this = this;
    var option = $(this).data();
    bottlecms.uploadfile({
        elem: this,
        data: option,
        success: function (pic) {
            $(_this).prev('input').val(pic)
            if (option.function) eval(option.function + "('" + pic + "')");
            if (option.previews) $(option.previews).attr('src', pic);
        }
    })
});


$('[bottlecms-upload-button]').each(function(index, el) {
    var _this = this;
    bottlecms.layuiuploadfile({
        elem:_this,
        success:function(pic){
            $(_this).prev('input').val(pic);
            var previews =  $(_this).attr('data-previews');
            if(previews){
                $(previews).attr('src',pic);
            }
            var datafunction = $(_this).attr('data-function');
            if(datafunction){
                eval(datafunction+"('" + pic + "')");
            }
        }
    })
});